package com.blog.Bard.base.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.blog.Bard.base.dao.UrlMatchingDao;
import com.blog.Bard.base.pojo.UrlMatching;
import com.blog.Bard.common.service.BaseServiceImpl;
import com.blog.Bard.common.util.Pager;

@Service
@Transactional
public class UrlMatchingServiceImpl extends BaseServiceImpl implements UrlMatchingService {

	@Autowired
	private UrlMatchingDao urlMatchingDao;
	
	@Override
	public List<UrlMatching> findAll() throws Exception {
		return urlMatchingDao.findAll();
	}

	@Override
	public Pager pageList(Map<String, Object> params) throws Exception {
		Integer pageNo = (Integer)params.get("pageNo");
		Integer pagesize = (Integer)params.get("pagesize");

		StringBuilder sql = new StringBuilder();
		List<Object> args = new ArrayList<Object>();
		
		sql.append(" select * from urlMatching \n");
		
		return urlMatchingDao.getPagerBySql(sql.toString(), pageNo, pagesize, args.toArray());
	}

	@Override
	public void del(Integer id) throws Exception {
		urlMatchingDao.deleteById(id);
	}

	@Override
	public void save(UrlMatching t) throws Exception {
		urlMatchingDao.save(t);
	}

	@Override
	public UrlMatching getOne(Integer id) throws Exception {
		return urlMatchingDao.getOne(id);
	}

}
